package com.csgc.camera.widget.dialog

import android.content.Context
import android.view.Gravity
import androidx.annotation.StyleRes
import com.csgc.camera.util.ViewUtils
import com.csgc.camera.util.clickWithTrigger
import com.csgc.camera.widget.dialog.base.AnimAction
import com.csgc.camera.widget.dialog.base.BaseDialog
import com.cysd.spsyxj.R
import com.cysd.spsyxj.databinding.DialogOpenVipSuceessBinding

class OpenVipSuccessDialog constructor(
    context: Context,
    @StyleRes themeResId: Int = R.style.BaseDialogTheme
) :
    BaseDialog(context, themeResId) {
    var listener: OnItemListener? = null
    val mBinding = DialogOpenVipSuceessBinding.inflate(layoutInflater)

    init {
        setWidth(ViewUtils.getScreenWidth(context) - ViewUtils.dp2px(60f))
        setContentView(mBinding.root)
        setWindowAnimations(AnimAction.ANIM_IOS)
        setGravity(Gravity.CENTER)
        setCancelable(false)

        initLister()
    }

    private fun initLister() {
        mBinding.apply {
            tvUse.clickWithTrigger {
                listener?.onUse()
            }
        }
    }

    interface OnItemListener {
        fun onUse()
    }
}
